package com.grapecc.cloudalibaba.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import javax.annotation.Resource;

/**
 * @author 卖糖的兜兜
 * @version 1.0.0
 * @ClassName PaymentController.java
 * @Description TODO
 * @createTime 2022年03月20日 19:05:00
 */
@RestController
@Slf4j
public class OrderNacosController {
    @Resource
    private RestTemplate  restTemplate;

    @Value("${service-url.nacos-user-service}")
    private String serverUrl;

    @GetMapping("/consumer/payment/get/{id}")
    public String getOrderNacos(@PathVariable(name = "id") String id){
        return restTemplate.getForObject(serverUrl+"/payment/nacos/"+id , String.class);
    }
}
